package com.renwei.yunlong.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.renwei.yunlong.R;
import com.renwei.yunlong.activity.DepartmentSearchActivity;
import com.renwei.yunlong.activity.FriendsEnterpriseActivity;
import com.renwei.yunlong.activity.FunctionSearchActivity;
import com.renwei.yunlong.base.BaseFragment;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 通讯录--fragment
 * <p>
 * Created by Administrator on 2017/8/24.
 */

public class ContactsFragment extends BaseFragment implements View.OnClickListener {

    @Bind(R.id.tv_title)
    TextView tvTitle;
    @Bind(R.id.iv_contacts)
    ImageView ivContacts;//管理人员显示加号、普通人员隐藏
    @Bind(R.id.rl_department)
    RelativeLayout rlDepartment;
    @Bind(R.id.rl_function)
    RelativeLayout rlFunction;
    @Bind(R.id.rl_friends)
    RelativeLayout rlFriends;
    @Bind(R.id.iv_cont)
    ImageView ivCont;//通讯录

    @Override
    public View initView() {
        View view = LayoutInflater.from(mActivity).inflate(R.layout.fragment_contacts, null);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    public void initData() {
        tvTitle.setText("通讯录");
        ivContacts.setVisibility(View.VISIBLE);
        ivContacts.setOnClickListener(this);

        rlDepartment.setOnClickListener(this);
        rlFunction.setOnClickListener(this);
        rlFriends.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.rl_department://部门
                startActivity(new Intent(getActivity(), DepartmentSearchActivity.class));
                break;
            case R.id.rl_function://职能
                startActivity(new Intent(getActivity(),FunctionSearchActivity.class));
                break;
            case R.id.rl_friends://好友
                startActivity(new Intent(getActivity(), FriendsEnterpriseActivity.class));
                break;
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
